#include <REGX52.H>
#include "Delay.h"
#include "MatrixLED.h"

//unsigned char Animation[] = {//此方式定义的数组存放于RAM中，若数据很多的话会占用RAM
//	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
//	0xFF,0x08,0x08,0x08,0xFF,0x00,0x0E,0x15,
//	0x15,0x0D,0x00,0x7E,0x01,0x02,0x00,0x7E,
//	0x01,0x02,0x00,0x0E,0x11,0x11,0x0E,0x00,
//	0x7D,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
//};
unsigned char code Animation[] = {//此方式定义的数组存放于FLASH中，
	//FLASH存储空间比RAM大，不占用内存，但此存储方式只读，不可更改数组成员的值
	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
	0xFF,0x08,0x08,0x08,0xFF,0x00,0x0E,0x15,
	0x15,0x0D,0x00,0x7E,0x01,0x02,0x00,0x7E,
	0x01,0x02,0x00,0x0E,0x11,0x11,0x0E,0x00,
	0x7D,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
};
void main(void)
{
	unsigned char i,Offset = 0,Count = 0;
	MatrixLED_Init();
	while (1)
	{
		for (i = 0;i < 8;i++)
		{
			MatrixLED_ShowColumn(i,Animation[i + Offset]);
		}
		//Delay1ms(10);错误！！！因为单片机需要不断地扫描并控制LED显示，
		//加延时会中断扫描，导致显示失败
		Count++;
		if (Count > 10)
		{
			Count = 0;
			Offset++;
			if (Offset > 32)
			{
				Offset = 0;
			}

		}
	}
}
